package com.example.exception;

import com.example.pojo.Result;
import org.springframework.web.bind.annotation.*;

/**
 * ClassName:GlobalExcption
 * Description:
 *
 * @Author 赵永峰
 * @Create 2024/5/9 10:46
 * @Version 1.0
 */
@RestControllerAdvice
public class GlobalException {

    @ExceptionHandler(ServiceException.class)
    public Result serviceException(ServiceException exception){
        return Result.error(exception.getCode(), exception.getMessage());
    }
}
